<?php

//Gestion du cache du GKZID

class Mysql{
	public function __construct(){
		dbconnect();
		}
		
	public function add($id,$hash){
		global $db_prefix;
		mysql_query("INSERT INTO `".$db_prefix."hashes` (`id`, `idclient`, `hash`) VALUES (NULL, '".$id."', '".$hash."');");
		echo(mysql_error());
		}
		
	public function get($id){
		global $db_prefix;
		$req="SELECT * FROM `".$db_prefix."hashes` WHERE `idclient`= '".$id."'";
		
		$req2=mysql_query($req);
		echo(mysql_error());
		$data=mysql_fetch_assoc($req2);
		$hash=$data['hash'];
		
		echo(mysql_error());
		return($hash);
		}
	
	public function del($id){
		global $db_prefix;
		mysql_query("DELETE FROM `".$db_prefix."hashes` WHERE `idclient` = '".$id."'");
		echo(mysql_error());
		}
	
	}
	
?>